clang: disable the gcc-compat warnings for read_atomic
authorRoger Pau Monné <roger.pau@citrix.com>
Thu, 13 Apr 2017 15:33:21 +0000 (17:33 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 13 Apr 2017 15:33:21 +0000 (17:33 +0200)
commitb0ad468512df579d71650acbbcd65ef9307c3f45
treee69dce027acb15cdd2cb1953336a430e5006aa3d
parentc1f9b9d77ceecb9fb782e4ab98ec3b94cf22dab8
clang: disable the gcc-compat warnings for read_atomic

clang gcc-compat warnings can wrongly fire when certain constructions are used,
at least the following flow:

switch ( ... )
{
case ...:
    while ( ({ int x; switch ( foo ) { case 1: x = 1; break; } x }) )
    {
        ...

Will cause clang to emit the following warning "'break' is bound to loop, GCC
binds it to switch", which is a false positive, and both gcc and clang bind
the break to the inner switch. In order to workaround this issue, disable the
gcc-compat checks for the usage of the read_atomic macro.

This has been reported upstream as http://bugs.llvm.org/show_bug.cgi?id=32595.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
xen/include/asm-x86/atomic.h
xen/include/xen/compiler.h